# 第一题：
# import random
# # 生成随机数
# target_number = random.randint(1, 100)
# guesses_left = 10
# print("我已经生成了一个1到100之间的整数请在10次机会内猜对。")
# while guesses_left > 0:
#     guess = int(input("请您输入数字:"))
#     if guess < target_number:
#         print("太小了！")
#     elif guess > target_number:
#         print("太大了！")
#     else:
#         print("恭喜你猜对了")
#         break
#         # 剩余游戏次数
#     guesses_left -= 1
#     if guesses_left == 0:
#         print("游戏结束，你没有猜对。答案是：" + str(target_number))
#     else:
#         print("你还有{}次机会。".format(guesses_left))


# #第二题：
# import random
# def judge(user, computer):
#     if user == computer:
#         return 0
#     elif user == 1 and computer == 3 or user == 2 and computer == 1 or user == 3 and computer == 2:
#         return 1
#     else:
#         return -1
# user_score = 100
# computer_score = 100
# print("欢迎来到剪刀石头布游戏！你和电脑的初始分数都是100。")
# while user_score > 0 and user_score < 200:
#     print("当前分数：您的{}分，电脑{}分".format(user_score, computer_score))
#     user_choice = int(input("您的选择是（1:剪刀, 2:石头, 3:布）："))
#     computer_choice = random.randint(1, 3)
#     if user_choice not in [1, 2, 3]:
#         print("请输入有效的选择！")
#         continue
#     result = judge(user_choice, computer_choice)
#     if result == 1:
#         user_score += 10
#         print("你赢了！")
#     elif result == -1:
#         user_score -= 10
#         print("你输了！")
#     else:
#         print("平局！")
#     computer_score -= result * 10
#
# if user_score >= 200:
#     print("你赢了！您的{}分，电脑{}分".format(user_score, computer_score))
# else:
#     print("你输了。您的{}分，电脑{}分".format(user_score, computer_score))


# #第三题
# def is_symmetric_array(arr):
#     n = len(arr)
#     for i in range(n // 2):
#         if arr[i] != arr[n - i - 1]:
#             return False
#     return True
# print(is_symmetric_array([1, 2, 3, 3, 2, 1]))  # 输出: True
# print(is_symmetric_array([1, 2, 3, 4, 5]))  # 输出: False


# 第四题
# a = ["hello", "world", "yoyo", "congratulations"]
# longest_word = max(a, key=len)
# print("最长的单词是:", longest_word)
